package com.sgb.knowledgeshare.viewmodel;

import androidx.lifecycle.ViewModel;

import com.sgb.knowledgeshare.ShareConfig;
import com.sgb.knowledgeshare.view.fragment.ShareMinUserListFragment;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.util.MToast;
import com.swgk.core.view.entity.VideoListEntity;

import java.util.HashMap;
import java.util.Map;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by fq on 2020/9/22 0022
 * Description：
 */
public class ShareMinUserListModel extends ViewModel {

    ShareMinUserListFragment shareminuserlistfragment;
    public void setActivity(ShareMinUserListFragment shareMinUserListFragment) {
        shareminuserlistfragment = shareMinUserListFragment;
    }

    //获取用户视频列表信息
    public void getVideoListData(int page, String userid, String userShareType) {
        Map map = new HashMap();
        map.put("pageNum", page);
        map.put("pageSize", "20");
        map.put("userNo", userid);
        map.put("type", userShareType);
        map.put("videoId", "");
        ShareConfig.getInstance().getApi().getmyVodList(map).enqueue(new ICallBack<BaseEntity<VideoListEntity>>() {
            @Override
            public void onSuccess(BaseEntity<VideoListEntity> data) {
                if (data.getData() == null) {
                    return;
                }
                if (data.getState().equals(ShareConfig.RESPONSE_OK)) {
                    shareminuserlistfragment.setVideoListData(data.getData());
                }
            }
        });
    }


}
